#
# Created By: Xiaofeng.Gu 2021/03/17
#
if(WIN32)
    LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib/Release)
else()
    LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib)
endif()
add_executable(CybertronTaskRunnerPool "")

include_directories("${CYBERTRON_PATH_SOURCE}/Service/TaskRunnerPool")
include_directories("${CYBERTRON_PATH_SOURCE}/CoreLibrary/include")
include_directories("${CYBERTRON_PATH_SOURCE}/Protocol/Output/cpp")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/asio")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/osi/osi3")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty")


IF (WIN32)
	add_definitions(-D_WIN32_WINNT=0x0501)
ENDIF()

add_definitions(-DNOMINMAX)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-DASIO_STANDALONE)
IF (WIN32)
  add_definitions(-D_WIN32_WINNT=0x0501)
ENDIF()

file(GLOB srcs *.h *.hh *i *.hpp *.c *.cc *.cpp)
file(GLOB_RECURSE net_files "Net/*.cpp" "Net/*.hpp")
set(srcs ${srcs} ${net_files})

target_sources(CybertronTaskRunnerPool PRIVATE ${srcs})
source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${srcs})

SetDefaultTargetProperties(CybertronTaskRunnerPool)
if (WIN32)
target_link_libraries(CybertronTaskRunnerPool advapi32
       iphlpapi
       psapi
       shell32
       user32
       userenv
       ws2_32
       crypt32    #for libcurl
       Wldap32    #for libcurl
       Normaliz   #for libcurl
	   pdh # for pdh_util/query.cpp
       ${CYBERTRON_PATH_ROOT}/3rdparty/libcurl/lib_win_x64/libcurl_a.lib)
else()
target_link_libraries(CybertronTaskRunnerPool pthread)
target_link_libraries(CybertronTaskRunnerPool rt)
endif()

target_link_libraries(CybertronTaskRunnerPool CybertronCore)
target_link_libraries(CybertronTaskRunnerPool protobuf)


IF (MSVC)
  SET_PROPERTY(TARGET CybertronTaskRunnerPool PROPERTY FOLDER "Service")
ENDIF()
